// File:    Khoa.cs
// Author:  WIN7
// Created: Thursday, April 17, 2014 4:14:13 PM
// Purpose: Definition of Class Khoa

using System;

public class Khoa
{
   public byte makhoa;
   public string tenkhoa;
   
   public System.Collections.Generic.List<Sinhvien> co;
   
   /// <summary>
   /// Property for collection of Sinhvien
   /// </summary>
   /// <pdGenerated>Default opposite class collection property</pdGenerated>
   public System.Collections.Generic.List<Sinhvien> Co
   {
      get
      {
         if (co == null)
            co = new System.Collections.Generic.List<Sinhvien>();
         return co;
      }
      set
      {
         RemoveAllCo();
         if (value != null)
         {
            foreach (Sinhvien oSinhvien in value)
               AddCo(oSinhvien);
         }
      }
   }
   
   /// <summary>
   /// Add a new Sinhvien in the collection
   /// </summary>
   /// <pdGenerated>Default Add</pdGenerated>
   public void AddCo(Sinhvien newSinhvien)
   {
      if (newSinhvien == null)
         return;
      if (this.co == null)
         this.co = new System.Collections.Generic.List<Sinhvien>();
      if (!this.co.Contains(newSinhvien))
      {
         this.co.Add(newSinhvien);
         newSinhvien.Thuoc = this;
      }
   }
   
   /// <summary>
   /// Remove an existing Sinhvien from the collection
   /// </summary>
   /// <pdGenerated>Default Remove</pdGenerated>
   public void RemoveCo(Sinhvien oldSinhvien)
   {
      if (oldSinhvien == null)
         return;
      if (this.co != null)
         if (this.co.Contains(oldSinhvien))
         {
            this.co.Remove(oldSinhvien);
            oldSinhvien.Thuoc = null;
         }
   }
   
   /// <summary>
   /// Remove all instances of Sinhvien from the collection
   /// </summary>
   /// <pdGenerated>Default removeAll</pdGenerated>
   public void RemoveAllCo()
   {
      if (co != null)
      {
         System.Collections.ArrayList tmpCo = new System.Collections.ArrayList();
         foreach (Sinhvien oldSinhvien in co)
            tmpCo.Add(oldSinhvien);
         co.Clear();
         foreach (Sinhvien oldSinhvien in tmpCo)
            oldSinhvien.Thuoc = null;
         tmpCo.Clear();
      }
   }

}